<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/common/common.jsp"%>
<%@ include file="/WEB-INF/common/taglib.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
	<div class="container" style="width:98%;padding:8px;">
		<div class="row">
			<div class="panel panel-default">
				<div class="panel-heading">
					<c:choose>
   						<c:when test="${empty modelMap}">新增</c:when>
   						<c:otherwise>修改</c:otherwise>
				    </c:choose>
			    </div>
				<div class="panel-body">
						<form class="form-horizontal" role="form" id="dailogForm" action="<%=path%>/common/doMerge/${tableName}.do" method="POST">
							<c:choose>
		   						<c:when test="${not empty addOrModifyList}">
		   								<c:forEach items="${addOrModifyList}" var="addOrModifyInfo" varStatus="vs">
		   										<c:choose>
													<c:when test="${addOrModifyInfo.isPrimary=='1'}">
														<input type="hidden" value="${modelMap[addOrModifyInfo['columnName']]}" name="${addOrModifyInfo.columnName}" />
													</c:when>
													<c:otherwise>
			   										<div class="form-group">
														<label for="${addOrModifyInfo.columnName}" class="col-sm-2 control-label" style="text-align:left;">
																${addOrModifyInfo.columnComment}
														</label>
													    <div class="col-sm-8">
													      <input type="text" value="${modelMap[addOrModifyInfo['columnName']]}" name="${addOrModifyInfo.columnName}" id="${addOrModifyInfo.columnName}" class="form-control" />
													    </div>
												    </div>
												    </c:otherwise>
											    </c:choose>
		   								</c:forEach>	
		   						</c:when>
		   						<c:otherwise>
		   								<c:forEach items="${tableFieldAttributes}" var="info" varStatus="vs">	
											<c:choose>
												<c:when test="${info.column_key=='PRI'}">
													<input type="hidden" value="${modelMap[info['column_name']]}" name="${info.column_name}" />
												</c:when>
												<c:when test="${info.column_key!='PRI'}">
				   									<div class="form-group">
														<label for="${info.column_name}" class="col-sm-2 control-label" style="text-align:left;">
																${info.column_comment}
														</label>
													    <div class="col-sm-8">
													      <input type="text" value="${modelMap[info['column_name']]}" name="${info.column_name}" id="${info.column_name}" class="form-control" />
													    </div>
											    	</div> 
											    </c:when>
										    </c:choose>
									    </c:forEach>
		   						</c:otherwise>
						    </c:choose>
							<!--  
							<c:if test="${not empty tableFieldAttributes}">
									<c:forEach items="${tableFieldAttributes}" var="info" varStatus="vs">	
										<c:choose>
										<c:when test="${info.column_key=='PRI'}">
											<input type="hidden" value="${modelMap[info['column_name']]}" name="${info.column_name}" />
										</c:when>
										<c:when test="${info.column_key!='PRI'}">
											<c:choose>
						   						<c:when test="${not empty addOrModifyList}">
						   								<c:forEach items="${addOrModifyList}" var="addOrModifyInfo" varStatus="vs">
						   										<div class="form-group">
																	<label for="${addOrModifyInfo.columnName}" class="col-sm-2 control-label" style="text-align:left;">
																			${addOrModifyInfo.columnComment}
																	</label>
																    <div class="col-sm-8">
																      <input type="text" value="${modelMap[addOrModifyInfo['columnName']]}" name="${addOrModifyInfo.columnName}" id="${addOrModifyInfo.columnName}" class="form-control" />
																    </div>
															    </div>
						   								</c:forEach>	
						   						</c:when>
						   						<c:otherwise>
						   								<div class="form-group">
															<label for="${info.column_name}" class="col-sm-2 control-label" style="text-align:left;">
																	${info.column_comment}
															</label>
														    <div class="col-sm-8">
														      <input type="text" value="${modelMap[info['column_name']]}" name="${info.column_name}" id="${info.column_name}" class="form-control" />
														    </div>
													    </div> 
						   						</c:otherwise>
										    </c:choose>-->
										    <!-- 
											<div class="form-group">
												<label for="${info.column_name}" class="col-sm-2 control-label" style="text-align:left;">
														${info.column_comment}
												</label>
											    <div class="col-sm-8">
											      <input type="text" value="${modelMap[info['column_name']]}" name="${info.column_name}" id="${info.column_name}" class="form-control" />
											    </div>
										    </div> 
									    </c:when>
									    </c:choose>
									</c:forEach>
							</c:if>-->
							
							<div class="form-group">
								<div class="col-sm-offset-5 col-sm-10">
									<a type="button" class="btn btn-sm btn-default" id="formReturn" data-dismiss="modal" href="<%=path%>/common/queryPageList/${tableName}.do">返回</a>
   									<button type="button" class="btn btn-sm btn-primary" id="formSubmit" onclick ="javascript:$('#dailogForm').submit();">提交</button>
								</div>
 							</div>
						</form>
				</div>
			</div>
		</div>
	</div>
</body>
</html>